package controllers;

import play.mvc.Http;
import play.mvc.Result;
import play.mvc.Security;

/**
 * Created with IntelliJ IDEA.
 * User: bjornth
 * Date: 25.2.2013
 * Time: 15:53
 * To change this template use File | Settings | File Templates.
 */

public class Secured extends Security.Authenticator{

    @Override
    public String getUsername(Http.Context ctx){
        return ctx.session().get("kennitala");
    }

    @Override
    public Result onUnauthorized(Http.Context ctx){
        return redirect(routes.AccountController.login());
    }

}